<?php
include '../includes/config.inc.php';

mysql_select_db($dbname, $conn) or die ('Error connecting to mysql');

echo '<p>Setting up tables..........</p><br></br>';

// ----> Create the admin table

$sql = "CREATE TABLE admin ( id int(4) NOT NULL auto_increment,adminuser varchar(15),password varchar(15),dbmailuser varchar(15),dbmailpass varchar(15),dbmaildb varchar(15),PRIMARY KEY (`id`) )TYPE=MyISAM AUTO_INCREMENT=2";


mysql_query($sql,$conn);

echo '<p>Success</p><br></br>';

// ----> END Create admin table

// Insert information into the table 

echo '<p>Adding user to admin table</p><br></br>';

// ----> Setup variables from the form on install/index.php

$name = $_POST['name'];
$password = $_POST['password'];
$dbmailuser = $_POST['dbmailuser'];
$dbmailpass = $_POST['dbmailpass'];
$dbmaildb = $_POST['dbmaildb'];

// ----> END variable setup

$setupadminuser = "INSERT INTO admin (adminuser, password, dbmailuser, dbmailpass, dbmaildb) VALUES ('$name','$password', '$dbmailuser', '$dbmailpass', '$dbmaildb')";

// ----> Insert details from from on install/index.php into database
mysql_query($setupadminuser) or die(mysql_error());

// END insert information into the table 

// ----> Close the mysql connection because we don't need it anymore

mysql_close($conn);

//Tell user to deleted the install directory so bad shit don't happen

echo '<h1><strong>Please remove the install directory!</strong>'

?>